from time import sleep

from celery_tasks.main import celery_app
from celery_tasks.sms.yuntongxun.sms import CCP


# 2 定义任务函数
@celery_app.task(name ='send_sms_code') # 使用装饰器装饰
def send_sms_code(mobile, sms_codes):
    '''发送短信验证码'''
    print(CCP().send_template_sms(mobile, [sms_codes, 5], 1))
    print('发送短信验证码', sms_codes)

    sleep(5)  # 设置阻塞
    return sms_codes